<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增医生管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-doctor-add" autocomplete="off">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">医生姓名：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">医生电话：</label>
                <div class="col-sm-8">
                    <input name="phone" id="phone" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">医生性别：</label>
                <div class="col-sm-8">
                    <select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">医生地址：</label>
                <div class="col-sm-8">
                    <input name="address" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证号：</label>
                <div class="col-sm-8">
                    <input name="idcard" id="idcard"  class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
            <input name="delFlag" value="0" type="hidden">
            <input name="status" value="0" type="hidden">
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "info/doctor"
        $("#form-doctor-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var reg = /^[1][3,4,5,7,8,9][0-9]{9}$/
                var phone=$("#phone").val()
                if(phone&&phone!=''){
                    if (!reg.test(phone)) {
                        $.modal.alertWarning("请输入正确的手机号");
                        return;
                    }
                }
                reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
                var idcard=$("#idcard").val()
                if(idcard&&idcard!=''){
                    if (!reg.test(idcard)) {
                        $.modal.alertWarning("请输入正确的身份证号");
                        return;
                    }
                }
                $.operate.save(prefix + "/add", $('#form-doctor-add').serialize());
            }
        }
    </script>
</body>
</html>
